package com.huanletao.lang;

import org.apache.commons.lang3.RandomStringUtils;

/**
 * <p>
 *   RandomStringUtils 常用方法示例;
 *
 * </p>
 *
 * @package: com.huanletao.api
 * @description:
 * @className: RandomStringUtilsApiTest
 * @author: @踏雪无痕.
 * @date: Created in 2022/5/30
 * @copyright: Copyright (c) 2022/5/30
 * @version: V1.0
 */
public class RandomStringUtilsApiTest {

    public static void main(String[] args) {
        //随机生成n位数数字
        System.out.println("RandomStringUtils.randomNumeric(3) = " + RandomStringUtils.randomNumeric(3));
        //在指定字符串中生成长度为n的随机字符串
        String abcdefghijk = RandomStringUtils.random(4, "abcdefghijk");
        System.out.println("abcdefghijk = " + abcdefghijk);
        //指定从字符或数字中生成随机字符串
        System.out.println(RandomStringUtils.random(3, false, false));
        System.out.println(RandomStringUtils.random(4, false, true));

    }
}
